package mmc.server.shell.ops.function;

import mmc.server.shell.Shell;
import mmc.server.shell.ShellException;
import mmc.server.shell.ops.Function;
import mmc.server.shell.ops.Variable;

public class Set extends Function {
	
    public Set(String text) throws ShellException {
        super(text, "set", 0, false);
    }

    @Override
    public double execute() {
        throw new RuntimeException(this+" has no return value");
    }
    
    public Object executeComplex(){
    	for(Variable v : Shell.environment.values()){
    		Shell.out.printf("%-7s %-7s %s\n",v.text,v.getOutputType().getSimpleName(),v.executeComplex().toString());
    	}
    	return null;
    }
    
    public Class<?> getOutputType(){
    	return void.class;
    }
    
    public static String getDescription(){
    	return formatHelpString("set()","list variables");
    }
}
